//
//  HRMessageRootSystemCell.m
//  Hear
//
//  Created by mac on 2017/10/17.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRMessageRootSystemCell.h"
@implementation HRMessageRootSystemCell



-(void)setUnreadCount:(NSUInteger)unreadCount{
    self.badgeView.hidden = !unreadCount;
    self.badgeView.text = [NSString stringWithFormat:@"%d",unreadCount];
}

+(instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellID = @"HRMessageRootSystemCell";
    
    HRMessageRootSystemCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if(!cell){
        cell = [[HRMessageRootSystemCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
        self.iconImageView.layer.cornerRadius = self.iconImageView.width/2;
        self.iconImageView.clipsToBounds = YES;
        [self addSubview:self.iconImageView];
        
        
        
        UILabel *badgeView = [UILabel new];
        badgeView.backgroundColor = CustomColor(250, 26, 41, 1);
        [self  addSubview:(self.badgeView=badgeView)];
        badgeView.frame = CGRectMake(kScreenWidth-20, 22, 15, 15);
        badgeView.layer.cornerRadius = badgeView.width/2;
        badgeView.clipsToBounds = YES;
        badgeView.hidden = YES;
        badgeView.textColor = [UIColor whiteColor];
        badgeView.font = CustomUIFont(13);
        badgeView.textAlignment = 1;
        
        
        self.typeLabel = [UILabel new];
        self.typeLabel.font = CustomUIFont(17);
        self.typeLabel.textColor = FirstTextColor;
        [self  addSubview:self.typeLabel];
        self.typeLabel.frame = CGRectMake(self.iconImageView.right+20, 20, 100, 20);
        
        
        
        UILabel *lineLabel = [UILabel new];
        lineLabel.backgroundColor = CustomColor(240, 240, 240, 1);
        [self  addSubview:lineLabel];
        lineLabel.frame = CGRectMake(self.typeLabel.left, 59, kFullWidth-self.typeLabel.left, 1);
    }
    return self;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
